UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EgenyCY9+caFIOsBLZp0hl81LRZpj7+WJyrZHpIVlLs=' 
WHERE 
  key_id = '68bacd00df6d871afd8b66463645a04265314c1a785b85513f1f4491b09d8316' 
  AND (
    token = 'EgenyCY9+caFIOsBLZp0hl81LRZpj7+WJyrZHpIVlLs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053