UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kXNt4Ro/0Sop+qN4ssabewXYH+DjeUgWLfvHN3mpeyg=' 
WHERE 
  key_id = '23117eca2a92fb664e273e30a065087e2556d8fd41c1bcecd36ea0cdbe41044f' 
  AND (
    token = 'kXNt4Ro/0Sop+qN4ssabewXYH+DjeUgWLfvHN3mpeyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039