UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'et8IsE601ih5xoXhEaM0l4xZcpG4vC9JG2j56/Z+BPU=' 
WHERE 
  key_id = 'e9372323f91fffa206fced202e4d70ca0d079847fd308049215f245ae4f67b61' 
  AND (
    token = 'et8IsE601ih5xoXhEaM0l4xZcpG4vC9JG2j56/Z+BPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068