UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1dWPxFzbjuz7SO/0dO4QUXUJQR1fpSandYmGvZ3t2nI=' 
WHERE 
  key_id = '76c27ff91dd8633778494c1380dcdc6ceb456daa48127c031f53e90b19cb8869' 
  AND (
    token = '1dWPxFzbjuz7SO/0dO4QUXUJQR1fpSandYmGvZ3t2nI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023