UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9zOAR6leuVMPBCHQgUMCBNgaCRVN+mvhFkJefyxth7M=' 
WHERE 
  key_id = '9b85a0d8a183f8b2fca9dffc3146dba9b6431c4a2f78016b7459172292e78746' 
  AND (
    token = '9zOAR6leuVMPBCHQgUMCBNgaCRVN+mvhFkJefyxth7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023