UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0j6AhQJhXJn6ixaNWf11jMwYxHutWYtct9gDhcDlUdA='
WHERE
key_id = '78f20a8df8c96832ad4f2f430ace4172541eaf2a2907d098527bef00317d43ff'
AND (
token = '0j6AhQJhXJn6ixaNWf11jMwYxHutWYtct9gDhcDlUdA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)