UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'obT961F1iz9JIWrPIEF3FpXhjI8ugQZQA6nAH2EHLMk='
WHERE
key_id = 'f99d94276b3993278accc64b0e2e5ddcaf7cf3c13a0ce9d498be492ef984e6c5'
AND (
token = 'obT961F1iz9JIWrPIEF3FpXhjI8ugQZQA6nAH2EHLMk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)