UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pOZJTqd3IE/yi2Ygoz1CD8dsAGe5Kh+pBNz2bYZOk5U=' 
WHERE 
  key_id = '5aa323d9e07b4c611e62c872e6334d78297dc35991952aaaf4876486be4af56f' 
  AND (
    token = 'pOZJTqd3IE/yi2Ygoz1CD8dsAGe5Kh+pBNz2bYZOk5U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032