UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wwA62WsB1uHSPI18h47MW3x5Jb7iDxY5i4jNac8cZkY='
WHERE
key_id = '02d4947bbccc08f68222d9c4079e542129d91c331b73c816672ab321aef8aa6f'
AND (
token = 'wwA62WsB1uHSPI18h47MW3x5Jb7iDxY5i4jNac8cZkY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)