UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bfFcZdLHLwoXVsWVKz+j0L90jasg9znhRD5LLRZFTn4='
WHERE
key_id = 'b1cea278c36d584ddce869d3bfc2b20ea441ef28b3c7df6f678e3075a752b736'
AND (
token = 'bfFcZdLHLwoXVsWVKz+j0L90jasg9znhRD5LLRZFTn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)