UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WzufW1olwMxvjH8iwWuxMPYUhuCBGy8NA1CM1mztIuo='
WHERE
key_id = '58d262aa67cbbb48a8a2ecd51e191217d63c3634a4ae8220ce66fd25dfd61bda'
AND (
token = 'WzufW1olwMxvjH8iwWuxMPYUhuCBGy8NA1CM1mztIuo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)