UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vG1gGUoEfLox/QboB/Q84yGc+SUyroM5LITRP+kKC3k=' 
WHERE 
  key_id = '37bae17c377664e869cdb964de6d0e0ec669cf62d07aa82b2178ca352c535e70' 
  AND (
    token = 'vG1gGUoEfLox/QboB/Q84yGc+SUyroM5LITRP+kKC3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038