UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WNgD16ThgrPbFvlPihovxQU5CCJMH95H0h+IIjYvxt8=' 
WHERE 
  key_id = '4e57f6924e959d37f6635c79a8a1b2988df3ec9613fa2555634ee5f565a13b25' 
  AND (
    token = 'WNgD16ThgrPbFvlPihovxQU5CCJMH95H0h+IIjYvxt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030