UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwKz+Mnja37Ae6D3Q/CGaGPJjkW8z0uTkumsqDHxoaA=' 
WHERE 
  key_id = 'b4a289a8d58f096e59a77ad131a57a635a34130a0c86d6074e262397e60aecd5' 
  AND (
    token = 'AwKz+Mnja37Ae6D3Q/CGaGPJjkW8z0uTkumsqDHxoaA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031