UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YYYWMPbzLjRUgoreVd+WZNtBfDK0sgaxmrLZ9hbkArs='
WHERE
key_id = 'a030f01edf182f4b46c047d21e1d145e25e3dc6a453e27aa4a92ebc082e94763'
AND (
token = 'YYYWMPbzLjRUgoreVd+WZNtBfDK0sgaxmrLZ9hbkArs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)