UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'c71Fbojvo290Efhdt/k6J+FqE6EvxDdYgKy2ww3OKHU='
WHERE
key_id = '4c4188e87b8d99e00f9b292f08d9b56737ce4ee4487e8822a818a564555ffa5e'
AND (
token = 'c71Fbojvo290Efhdt/k6J+FqE6EvxDdYgKy2ww3OKHU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)