UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oOhpm1tBMOU0hgbkFNZUTATAiX56KCu/f12IVTZePW0=' 
WHERE 
  key_id = '6576637c4c372432835d6f7c34d23c152b63243add2d37b485acc125fa4b7eaf' 
  AND (
    token = 'oOhpm1tBMOU0hgbkFNZUTATAiX56KCu/f12IVTZePW0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027