UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XvvH0VZBYYsPEqBjByiAtQSuUVYMjs1ufQegixPKSio=' 
WHERE 
  key_id = '2e1dc9cdac3104172fe088ee497a04803429c829fbeb506741e3e758cedd2213' 
  AND (
    token = 'XvvH0VZBYYsPEqBjByiAtQSuUVYMjs1ufQegixPKSio=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040