UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y1M5+3xM14ilG0IaxgojlfnzNvzME5XpvbNnyKC+WEE=' 
WHERE 
  key_id = '5ddf9f905b2a7e59319aced5f7a5831029ddceb05e9c68b78700002b165a2902' 
  AND (
    token = 'y1M5+3xM14ilG0IaxgojlfnzNvzME5XpvbNnyKC+WEE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042