UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CLRTIgka8HOwqKC9Estyp5jsES6+v94WI92kooWz/FA=' 
WHERE 
  key_id = '39b2fc4dc3e4c70c029158698785ec024b2e244c0dad8677a60d9ae86da48ef8' 
  AND (
    token = 'CLRTIgka8HOwqKC9Estyp5jsES6+v94WI92kooWz/FA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033