UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HLLmvcxIYuLG8lHHqHH7Wegidv7VQsj/jaHQiKO7oFc=' 
WHERE 
  key_id = 'a2885e56640e68d79575fd87b9796625e7df319e098750ee31a9ff875255b90c' 
  AND (
    token = 'HLLmvcxIYuLG8lHHqHH7Wegidv7VQsj/jaHQiKO7oFc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028