UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1elmZmgDoi0FOgSOtTJh1YVpGioLiIEOCgKQ+9Ju6mI=' 
WHERE 
  key_id = 'a56aa010b98053d847504cabbdbae0b1510ab635091b4d5f5cf421c5e64e80e0' 
  AND (
    token = '1elmZmgDoi0FOgSOtTJh1YVpGioLiIEOCgKQ+9Ju6mI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043