UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KJpQIbBNALUsqQCB+WZ2E0y+RXWFqvHxlVZjFCrJKbA=' 
WHERE 
  key_id = 'd1c9628c519d3bfa5059b353b9376aa11b231332e660e3e1df45a4f01351d6a6' 
  AND (
    token = 'KJpQIbBNALUsqQCB+WZ2E0y+RXWFqvHxlVZjFCrJKbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031