UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'G2xBMx2xWNWRk+WW5XKj0wgwuSn0X/d08LsR7UReSdk=' 
WHERE 
  key_id = '4274341686e2cdbd7449025b1f3cfd966f15b375af527496797faf5a853bf3cf' 
  AND (
    token = 'G2xBMx2xWNWRk+WW5XKj0wgwuSn0X/d08LsR7UReSdk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056