UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+AjOv0yfg/tRtCT5q87o17VyxFva9Qehjt9xZVyIhjU='
WHERE
key_id = '5e495a06459c06d25750cfaf2a16fd6ca4025bf5e0b8776caffa4f3cde2b07cf'
AND (
token = '+AjOv0yfg/tRtCT5q87o17VyxFva9Qehjt9xZVyIhjU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)