UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XP9AJa5EXq2+avzfiSLK4eI1XCSYQ2POUnafPw6S5as=' 
WHERE 
  key_id = '0afc93d56f8f510ac10538944406fac0c91ed46feabcb03f572ad17e08277bdb' 
  AND (
    token = 'XP9AJa5EXq2+avzfiSLK4eI1XCSYQ2POUnafPw6S5as=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032