UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NxE7n6SQ7xkHBJTTA5EI0JW85s25/od+ms+v/atcUKQ=' 
WHERE 
  key_id = '019fe83151b83035a73e35b2979250923aed58d639bf45ea47600f844d6e7094' 
  AND (
    token = 'NxE7n6SQ7xkHBJTTA5EI0JW85s25/od+ms+v/atcUKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045