UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cdOl1XgceUpdezCUghA2I1lTjjBV7XGzUawbM5Z016k=' 
WHERE 
  key_id = '938f04ab74230a8dec780bae9ad66519023b176e1f195de658cb28ec0058c40b' 
  AND (
    token = 'cdOl1XgceUpdezCUghA2I1lTjjBV7XGzUawbM5Z016k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031