UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ptHoMF45WbBJmoj5LVw537WpoFLj2OcvDcdTJaXy58o=' 
WHERE 
  key_id = '15efe194a231ba4b7e940b0ad1beff391179ea5c1d90bfc25ba2f85323be084c' 
  AND (
    token = 'ptHoMF45WbBJmoj5LVw537WpoFLj2OcvDcdTJaXy58o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031