UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7A3tl3Rxla5oYTUfidTPo9TLgfzg5quJVti9tOy5zzU='
WHERE
key_id = 'cae5a7508eebf3d3884beab692be56f84bb2453f71f249878253e7a3f4662b0a'
AND (
token = '7A3tl3Rxla5oYTUfidTPo9TLgfzg5quJVti9tOy5zzU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)