UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0RPBNq3SbhwfGW6TEGjUSbjrGA+gAwp8IpBP+KGFEwU=' 
WHERE 
  key_id = 'e7531341f4f7ea289a13800949f48abfd69340f194ea89bbb5c83c11b48d000e' 
  AND (
    token = '0RPBNq3SbhwfGW6TEGjUSbjrGA+gAwp8IpBP+KGFEwU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031