UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qYGGq2pNisriwxy5ZQQV+XnszQi7J1L1rSNuKBN+ekk=' 
WHERE 
  key_id = 'c3779cb42098026100353945f31ea659e30da15e0680a0caf020456f02a66814' 
  AND (
    token = 'qYGGq2pNisriwxy5ZQQV+XnszQi7J1L1rSNuKBN+ekk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047