UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YCi33j1Kr9u8Ax4OGiR3dOylL4i0isDhxp2FdT0D06s='
WHERE
key_id = '048ae018d235df27d295ad8ad84eef31144b18746a6a83bfb326ece5fe0feadd'
AND (
token = 'YCi33j1Kr9u8Ax4OGiR3dOylL4i0isDhxp2FdT0D06s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)