UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bVhE1zGAON8AsXZhcLgd8D6E/TUAZFa53feK08II6rc=' 
WHERE 
  key_id = '13eeb118e5af737e05954636941d7be0f7fe7b8cd91fe9ddd22d1c925787bfe3' 
  AND (
    token = 'bVhE1zGAON8AsXZhcLgd8D6E/TUAZFa53feK08II6rc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064