UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yAx2OGjbFY3amnOxInfiuOsbIJgzArBrl1pD4Sm5d+k='
WHERE
key_id = 'f03caab1595163679d4b240b9f0d41350480b81cec591f8fc66cc8a506fa22cc'
AND (
token = 'yAx2OGjbFY3amnOxInfiuOsbIJgzArBrl1pD4Sm5d+k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)