UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UBxqtVamHZHWDXzUrqZ27o1ZWqiOsQkqOa3kPDJVnEQ=' 
WHERE 
  key_id = '74e1b7fb87b49f45921a26b84ccfac2807d7e8701cb085f0e52be00624de9a77' 
  AND (
    token = 'UBxqtVamHZHWDXzUrqZ27o1ZWqiOsQkqOa3kPDJVnEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045