UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9K7i6cPe3dPGCGWSS9vUDXN/QVdpF2BH6OIj0NTLM40='
WHERE
key_id = 'abb447f8b6a1905a32351302f7301c2ba060f87bcd2376642e7ef8e7f1bd9d4e'
AND (
token = '9K7i6cPe3dPGCGWSS9vUDXN/QVdpF2BH6OIj0NTLM40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)