UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dfsW9RF+0AMfmrqx/J8wL5By88obALMmuLuO8OxmMZg='
WHERE
key_id = 'bf977e155c9b9c1ee6a925f3887b392d0f9a99d23f0346b7051e2dc9263a6059'
AND (
token = 'dfsW9RF+0AMfmrqx/J8wL5By88obALMmuLuO8OxmMZg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)