UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZS+la754Mb3lt3844sXXN42W06ejDW615XNd9dQDoms=' 
WHERE 
  key_id = '8883c889d1e7f64309bc17a206729d5b228b8748e4f41cadafe90dc55bb596fd' 
  AND (
    token = 'ZS+la754Mb3lt3844sXXN42W06ejDW615XNd9dQDoms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052